package cn.com.yusys.yusp.admin.service;

import cn.com.yusys.yusp.admin.repository.mapper.MerchantManagementMapper;
import cn.com.yusys.yusp.commons.mapper.QueryModel;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class MerchantManagementService {

    @Resource
    MerchantManagementMapper merchantManagementMapper;

    @Transactional(readOnly = true)
    public List<Map<String, Object>> getMerchantManagementInfo(QueryModel model) {
        PageHelper.startPage(model.getPage(), model.getSize());
        List<Map<String, Object>> list = merchantManagementMapper.getMerchantManagementInfo(model);
        PageHelper.clearPage();
        return list;
    }

    @Transactional(readOnly = true)
    public Map<String, Object> getMerchantInformation(QueryModel model) {
        return merchantManagementMapper.getMerchantInformation(model);
    }

    @Transactional(readOnly = true)
    public int addMerchantManagement(QueryModel model) {
        return merchantManagementMapper.addMerchantManagement(model);
    }

    @Transactional(readOnly = true)
    public Integer updateMerchantManagement(QueryModel model) {
        return merchantManagementMapper.updateMerchantManagement(model);
    }

    @Transactional(readOnly = true)
    public int deleteMerchantManagement(List<String> list) {
        return merchantManagementMapper.deleteMerchantManagement(list);
    }
}
